﻿using GrapeCity.Forguncy.Plugin;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlugGraphVisVue
{

 
    /// <summary>
    /// 一、快速网络布局（fastForce）
    /// </summary>
    public class Layout_FastForce : ObjectPropertyBase
    {

        [DisplayName("节点间的排斥力")]
        [Description("取值范围 [0,1), 值越小节点越分散，值越大节点越紧密")]
        [DoubleProperty(AllowNull = true, Min = 0, Max = 0.99)]
        public double? friction { get; set; } = 0.8;


        [DisplayName("连线长度")]
        [Description("取值范围 [1,n), 直接相连节点间的长度系数，值越大，离中心点越远")]
        [IntProperty(AllowNull = true, Min = 1, Max = 999)]
        public int? linkDistance { get; set; } = 100;

        [DisplayName("连线拉力强度")]
        [Description("取值范围 [0,1), 直接相连的连线拉力，值越大，与核心点越紧密")]
        [DoubleProperty(AllowNull = true, Min = 0, Max = 0.99)]
        public double? linkStrength { get; set; } = 0.03;


        [DisplayName("吸引力")]
        [Description("负数到正数任意 (-n,n), 值越小节点越分散，值越大节点越紧密")]
        [IntProperty(AllowNull = true, Min = -999, Max = 999)]
        public int? charge { get; set; } = -200;

        [DisplayName("中心引力")]
        [Description("取值范围（0,1), 整个图相当于中心位置的引力，值越大，整个图越紧凑")]
        [DoubleProperty(AllowNull = true, Min = 0, Max = 0.99)]
        public double? gravity { get; set; } = 0.01;
    }



    /// <summary>
    /// 二、力导向布局（simulation）
    /// </summary>
    public class Layout_Simulation : ObjectPropertyBase
    {


        [DisplayName("吸引力")]
        [Description("负数到正数任意 (-n,n), 值越小节点越分散，值越大节点越紧密")]
        [IntProperty(AllowNull = true, Min = -999, Max = 999)]
        public int? strength { get; set; } = -1500;

        [DisplayName("是否分组")]
        [Description("true或false, 是否按节点类型进行分组布局")]
        [BoolProperty()]
        [DefaultValue(false)]
        public bool ajustCluster { get; set; } = false;
    }



    /// <summary>
    ///三、最优路径布局（kawakai）
    /// </summary>
    public class Layout_Kawakai : ObjectPropertyBase
    {


        [DisplayName("区域缩放系数")]
        [Description("取值范围 (0,10), 值越小节点越紧密，值越大布局区域节点越分散")]
        [IntProperty(AllowNull = true, Min = -999, Max = 999)]
        public int? sizeScale { get; set; } = -1500;


    }

    /// <summary>
    ///四、层级布局（hierarchical）
    /// </summary>
    public class Layout_Hierarchical : ObjectPropertyBase
    {


        [DisplayName("层间距")]
        [Description("取值范围 (50,500), 每一层之间的间距大小")]
        [IntProperty(AllowNull = true, Min = 50, Max = 500)]
        public int? layerSpace { get; set; } = 150;


        [DisplayName("节点间距")]
        [Description("取值范围 (20,100), 节点间的距离大小")]
        [IntProperty(AllowNull = true, Min = 20, Max = 100)]
        public int? nodeSpace { get; set; } = 60;

        [DisplayName("排序类型")]
        [ComboProperty(ValueList = "hubsize|directed|selected", DisplayList = "topo排序|连线方向|选中节点")]
        public string sortType { get; set; } = "hubsize";

        [DisplayName("排列方向")]
        [ComboProperty(ValueList = "UD|DU|LR|RL", DisplayList = "自上而下|自底而上|从左向右|从右向左")]
        public string direction { get; set; } = "TB";

    }



    /// <summary>
    ///五、同心圆布局（concentric）
    /// </summary>
    public class Layout_Concentric : ObjectPropertyBase
    {


        [DisplayName("最大节点大小")]
        [Description("取值[10,100] 图中节点大小，圆环分布通过大小计算出，值越大，圆环越大，节点越分散")]
        [IntProperty(AllowNull = true, Min = 10, Max = 100)]
        public int? maxNodeSize { get; set; } = 50;


    }

    /// <summary>
    /// 六、环形布局（circle）
    /// </summary>
    public class Layout_Circle : ObjectPropertyBase
    {


        [DisplayName("节点缩放比例")]
        [Description("取值[1,3] 图中缩放大小系数，值越大，圆环越大，节点越分散")]
        [DoubleProperty(AllowNull = true, Min = 1, Max = 3)]
        public double? gravity { get; set; } = 1.1;


    }

    /// <summary>
    ///七、球面引力布局（arf）
    /// </summary>
    public class Layout_Arf : ObjectPropertyBase
    {


        [DisplayName("邻居节点斥力")]
        [Description("取值[0.1,100] 值越大，相邻节点的距离越大")]
        [DoubleProperty(AllowNull = true, Min = 0.1, Max = 100)]
        public double? neighberForce { get; set; } = 5.0;

        [DisplayName("相邻点吸引力")]
        [Description("取值[0.1,100] 值越大，相邻节点的距离越大")]
        [DoubleProperty(AllowNull = true, Min = 0.1, Max = 100)]
        public double? attraction { get; set; } = 0.05;

        [DisplayName("斥力系数")]
        [Description("取值[0.1,100] 值越大图越分散")]
        [DoubleProperty(AllowNull = true, Min = 0.1, Max = 100)]
        public double? forceScale { get; set; } = 5.0;


    }



    /// <summary>
    /// 八、树形布局（tree）
    /// </summary>
    public class Layout_Tree : ObjectPropertyBase
    {


        [DisplayName("层间距")]
        [Description("取值范围 (50,500), 每一层之间的间距大小")]
        [IntProperty(AllowNull = true, Min = 50, Max = 500)]
        public int? layerSpace { get; set; } = 150;


        [DisplayName("节点间距")]
        [Description("取值范围 (20,100), 节点间的距离大小")]
        [IntProperty(AllowNull = true, Min = 20, Max = 100)]
        public int? nodeSpace { get; set; } = 60;


        [DisplayName("排列方向")]
        [ComboProperty(ValueList = "UD|DU|LR|RL", DisplayList = "自上而下|自底而上|从左向右|从右向左")]
        public string direction { get; set; } = "TB";

    }



    /// <summary>
    /// 九、网格布局（grid）
    /// </summary>
    public class Layout_Grid : ObjectPropertyBase
    {


        [DisplayName("层间距")]
        [Description("取值范围 (50,300), 值越大，层间距越大")]
        [IntProperty(AllowNull = true, Min = 50, Max = 300)]
        public int? layerSpace { get; set; } = 120;


        [DisplayName("节点间距")]
        [Description("取值范围 (50,300), 值越大，节点间距越大")]
        [IntProperty(AllowNull = true, Min = 50, Max = 300)]
        public int? nodeSpace { get; set; } = 120;


    }




    /// <summary>
    /// 十、流向布局（dagre）
    /// </summary>
    public class Layout_Dagre : ObjectPropertyBase
    {


        [DisplayName("层间距")]
        [Description("取值范围 (50,500), 每一层之间的间距大小")]
        [IntProperty(AllowNull = true, Min = 50, Max = 500)]
        public int? ranksep { get; set; } = 150;


        [DisplayName("点间距")]
        [Description("取值范围 (10,100), 节点间的距离大小")]
        [IntProperty(AllowNull = true, Min = 20, Max = 100)]
        public int? nodeSpace { get; set; } = 10;


        [DisplayName("节点大小")]
        [Description("节点的大小，会影响节点间的排放间距")]
        [IntProperty(AllowNull = true, Min = 20, Max = 100)]
        public int? nodeSize { get; set; } = 50;


        [DisplayName("排列方向")]
        [ComboProperty(ValueList = "UD|DU|LR|RL", DisplayList = "自上而下|自底而上|从左向右|从右向左")]
        public string rankdir { get; set; } = "TB";

    }



    /// <summary>
    /// 中心径向布局（radial）
    /// </summary>
    public class Layout_Radial : ObjectPropertyBase
    {
        [DisplayName("中心节点ID")]
        [Description("需要指定目标节点ID,否则取第一个节点ID")]
        public string rootNodeId { get; set; } = "";

        [DisplayName("布局方式")]
        [ComboProperty(ValueList = "radial|tree", DisplayList = "径向分布|层级分布")]
        public string type { get; set; } = "radial";


        [DisplayName("层间距")]
        [Description("type=tree时，影响分层间距")]
        [IntProperty(AllowNull = true, Min = 50, Max = 500)]
        public int? layerDist { get; set; } = 100;


        [DisplayName("节点大小")]
        [Description("type=tree时，影响同层的相邻节点间距")]
        [IntProperty(AllowNull = true, Min = 20, Max = 100)]
        public int? nodeSize { get; set; } = 50;



        [DisplayName("径向分布面半径")]
        [Description("ype=radial时，节点分布的区域半径大小")]
        [IntProperty(AllowNull = true, Min = 20, Max = 1000)]
        public int? areaRadius { get; set; } = 400;

    }


    /// <summary>
    /// 避免重叠（avoidlap）
    /// </summary>
    public class Layout_Avoidlap : ObjectPropertyBase
    {


        [DisplayName("间距间距")]
        [Description("取值范围 [1,50], 值越大，节点间距越大")]
        [IntProperty(AllowNull = true, Min = 1, Max = 50)]
        public int? maxPadding { get; set; } = 10;


    }

}
